#ifndef _NODE_H_
#define _NODE_H_

#include <iostream>
#include <ros/ros.h>
#include <ros/console.h>
#include <Eigen/Eigen>
#include "backward.hpp"

#define inf 1>>20
struct GridNode;
typedef GridNode* GridNodePtr;

// 节点表示:存储了节点的坐标、g(n)、f(n)值、访问该节点的上一级节点指针等信息
struct GridNode
{     
    int id;        // 1--> open set, -1 --> closed set
    // 节点坐标
    Eigen::Vector3d coord; 
    // 方向 
    Eigen::Vector3i dir;   // direction of expanding
    // 节点索引
    Eigen::Vector3i index;
	
    // g(n) 函数值
    double gScore;
    // f(n) 函数值
    double fScore;

    // 访问该节点的上一级节点指针
    GridNodePtr cameFrom;
    // 子节点指针
    std::multimap<double, GridNodePtr>::iterator nodeMapIt;

    GridNode(Eigen::Vector3i _index, Eigen::Vector3d _coord)
    {
      id = 0;
      index = _index;
      coord = _coord;
      dir   = Eigen::Vector3i::Zero();

      gScore = inf;
      fScore = inf;
      cameFrom = NULL;
    }

    GridNode(){};
    ~GridNode(){};
};


#endif
